{include file="head" /}

{include file="menu" /}

<!--main content start-->
      <section id="main-content">
          <section class="wrapper">
              
            <br>
            
             <div class="row">
                  <div class="col-lg-8">
                <section class="panel">
                  
                  <div class="panel-body bio-graph-info">
                      <h1 class="f_title"><button type="button" class="btn btn-primary " onclick="handle('backup')">添加幻灯片</button></h1>
                      <form class="form-horizontal" role="form" action="" method="post"  enctype="multipart/form-data" >
                          
                          <div class="form-group">
                              <label  class="col-lg-2 control-label">选择图片</label>
                              <div class="col-lg-6">
                                  <input type="file" class="form-control" name="img" aria-describedby="basic-addon1">
                              </div>
                          </div>

                         
                          <div class="form-group">
                              <div class="col-lg-offset-2 col-lg-10">
                                  <input type="submit" name="submit" class="btn btn-success" value="保存">
                              </div>
                          </div>
                      </form>
                  </div>
              </section> 
            </div>
              </div>

             <div class="row">
                  <div class="col-lg-8">
                      <section class="panel">
                          <header class="panel-heading">
                             首页幻灯片列表
                          </header>
                          <table class="table table-striped table-advance table-hover">
                            <thead class="ordertable">
                              <tr>
                                <th>编号</th>
                                <th>图片</th>
                                <th>操作</th>
                            </tr>
                          </thead>
                          <tbody>
                              {volist name="slide" id="vo"}
                              <tr>
                                  <td>{$vo.id}</td>
                                  <td><img src="{$vo.img}" height="100px" alt=""> </td>
                                  <td><button class="btn btn-danger btn-xs" onclick="deleteinfo('{$vo.id}')" title="点击删除"><i class="icon-trash "></i></button></td>
                              </tr>
                              {/volist}
                              
                              </tbody>
                          </table>
                      </section>
                  </div>
              </div>
              
           

          </section>
      </section>
      <!--main content end-->
  </section>

{include file="foot" /}
<script>
    function deleteinfo(id){
    layer.open({
      content: '确定删除吗',
      yes: function(index){
        //do something
        var url = "{:url('delslide')}"+"?id="+id;
        
        $.get(url,function(data){
          if (data.type == 1) {
              layer.msg(data.data, {icon: 1,time: 1000},function(){
                window.location.href="{:Url('homepic')}";
              }); 

            }else if(data.type == -1){
              layer.msg(data.data, {icon: 2}); 
            }
        });
      }
    });
  }


</script>